# 27. 移除元素
def removeElement(nums, val):
    """
    :type nums: List[int]
    :type val: int
    :rtype: int
    """
    slow_index = 0
    for loop_index in range(len(nums)):
        if nums[loop_index] != val:
            nums[slow_index] = nums[loop_index]
            slow_index += 1
    return slow_index


nums_1 = [2, 1, 2, 2, 3, 0, 4, 2]
val_1 = 2
result = removeElement(nums_1, 2)
print(f"removeElement nums_1:{nums_1},val_1:{val_1},result:{result}")
